#include "application.h"

using infinity::Application;

int main(int argc, char** argv)
{
	dw::system::DebugOutputLoggerListener debugListener;
	dw::system::StdOutputLoggerListener consoleListener;

	dw::system::Logger::getInstance().registerListener(&debugListener);
	dw::system::Logger::getInstance().registerListener(&consoleListener);

	try
	{
		Application::createInstance();

		Application& app(Application::getInstance());

		app.run(argc, argv);

		Application::destroyInstance();
	}
	catch (const std::exception& e)
	{
		dwUnused(e);
		dwBreak();
		return -1;
	}

	dw::system::Logger::getInstance().unregisterListener(&debugListener);
	dw::system::Logger::getInstance().unregisterListener(&consoleListener);

	return 0;
}
